class SeckillSpu < ApplicationRecord
  enum state: [:pending, :approve, :refuse]

  belongs_to :spu

  validate :start_cannot_bigger_than_end

  def start_cannot_bigger_than_end
    if start_at >= end_at
      errors.add(:start_cannot_bigger_than_end, '开始时间不能大于等于结束时间')
    end
  end
end
